package vcp.controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import vcp.common.AbstractController;
import vcp.common.IController;
import vcp.gui.forms.validators.NameValidator;
import vcp.gui.forms.validators.TextAreaValidator;
import vcp.models.CustomerContactModel;
import vcp.views.CustomerContactView;

/**
 * CustomerContact Controller
 * @author G15
 *
 */
public class CustomerContactController extends AbstractController implements
ActionListener, IController  {

	CustomerContactModel model;
	CustomerContactView view;
	@Override
	public void addModel(Object model) {
		this.model = (CustomerContactModel)model;		
	}

	@Override
	public void addView(Object view) {
		this.view = (CustomerContactView)view;	
	}

	@Override
	public void actionPerformed(ActionEvent eve) {
		boolean formIsValid = false;
	
		String title = view.getCustomerContactForm().getTxtSubject().getText();
		String message = view.getCustomerContactForm().getTxtMessage().getText();
		
		if(title.isEmpty() 
				|| message.isEmpty() 
				)
		{
			JOptionPane.showMessageDialog(null,
				   "Wrong input...");	
		}else{		
	    	model.ContactCustomer(12, 13, title, message);	
		}
	
   }

}
